Repository navigation
1.0.3: a host a browser reads as another IPv4 address is refused; the URLs 1.0.2 missed are checked - #27
Conversation
… URLs 1.0.2 missed are checked A browser reads https://0x7f.1/, https://0177.0.0.1/ and https://3.1.2/ as 127.0.0.1, 127.0.0.1 and 3.1.0.2; a host that ends in a number is accepted only as a canonical dotted quad (browser_safe), and an IP address has no subdomains (host_within, for device sign-in links, the company's device page and Browser Control's company hosts). A company's logo, a UCP profile's endpoint, the platform profile, a Signature-Agent (sent and verified; one a browser reads otherwise decides nothing), a Session JWT's issuer and the entries of protected_resources are checked as every HTTPS URL is. Tests: test_urls (+5, 41), the whole suite (1737).
There was a problem hiding this comment.
🟡 Changes recommended
URL validation still accepts a browser-interpreted loopback URL, can raise an uncaught exception on oversized numeric components, and rejects valid IPv6 literals containing dotted quads.
3 open issues
What changed in this PR
Release 1.0.3 strengthens Python SDK URL validation following the 1.0.2 security fix. TypeScript runtime behavior is unchanged; only version strings are updated.
Changes:
- Reject non-canonical numeric hosts and prevent IP addresses from matching as subdomains.
- Extend browser-safe URL checks to previously missed validation paths.
- Add regression tests and update release versions and documentation.
| File | Description |
|---|---|
src/reactor.ts |
Bump core plugin version. |
src/company/index.ts |
Bump company plugin version. |
personal_agent_protocol/urls.py |
Add numeric-host validation and shared host containment checks. |
personal_agent_protocol/ui.py |
Validate organization logo URL safety. |
personal_agent_protocol/ucp.py |
Validate endpoint and platform profile URL safety. |
personal_agent_protocol/reactor.py |
Bump Python core plugin version. |
personal_agent_protocol/operator_signatures.py |
Check Signature-Agent URL safety when signing and verifying. |
personal_agent_protocol/models.py |
Check protected-resource URL safety. |
personal_agent_protocol/device.py |
Use shared host containment for sign-in links. |
personal_agent_protocol/company/verify.py |
Check Session JWT issuer URL safety. |
personal_agent_protocol/company/service.py |
Use shared host containment for device pages. |
personal_agent_protocol/company/__init__.py |
Bump Python company plugin version. |
personal_agent_protocol/browser_control.py |
Use shared company-host containment checks. |
personal_agent_protocol/__version__.py |
Set Python SDK version to 1.0.3. |
personal_agent_protocol/__tests__/test_urls.py |
Add numeric-host, containment, and URL-check regressions. |
package.json |
Set TypeScript package version to 1.0.3. |
docs/docs/releases/compatibility.mdx |
Document 1.0.3 compatibility and validation changes. |
docs/docs/protocol/conformance-report.mdx |
Update the reported SDK version. |
CHANGELOG.md |
Describe the 1.0.3 security follow-up. |
Review effort: Balanced
| if not all(character in _AUTHORITY_CHARACTERS for character in netloc): | ||
| return False | ||
| try: | ||
| host = urlsplit(value).hostname or "" |
There was a problem hiding this comment.
Confirmed with Node's WHATWG URL: https:///0x7f.1/, https:/0x7f.1/ and https:0x7f.1/ all open 127.0.0.1. Fixed in #28 (1.0.4): browser_safe refuses a URL with no host for urlsplit, with regression cases for the three forms.
| # A host a browser reads as an IPv4 address is one only in its canonical form: a | ||
| # browser reads `0x7f.1`, `0177.0.0.1` and `3.1.2` as 127.0.0.1, 127.0.0.1 and | ||
| # 3.1.0.2, the SDK as the names they are written (the review of 1.0.2). | ||
| return not ends_in_a_number(host) or canonical_ipv4(host) |
There was a problem hiding this comment.
Right, fixed in #28 (1.0.4): an IPv6 literal is exempt from the IPv4 rule, and [::ffff:93.184.216.34] is a regression case.
| part.isascii() | ||
| and part.isdigit() | ||
| and (part == "0" or not part.startswith("0")) | ||
| and int(part) <= 255 |
There was a problem hiding this comment.
Confirmed, fixed in #28 (1.0.4): a part longer than three digits is refused before int. The tests cover canonical_ipv4, browser_safe and UcpProfile.endpoint, and an oversized issuer refused by unverified_session_issuer with invalid_session.


What
Release 1.0.3, the follow-up to 1.0.2 (#26) from the review of its fix. Python SDK only. The TypeScript SDK parses URLs with WHATWG
URL, as a browser does; only its version strings change.Non-canonical numeric hosts
The ASCII allowlist accepted hosts a browser reads as another IPv4 address. Each of these keeps its written hostname in
urlsplit:https://0x7f.1/deviceandhttps://0177.0.0.1/device: a browser reads both as 127.0.0.1.https://3.1.2/device: a browser reads 3.1.0.2. A company whose domain is1.2also admitted it as a "subdomain".Two changes:
browser_safeuses WHATWG's "ends in a number" rule. A host whose last label is all digits, or0xand hexadecimal digits, is a browser's IPv4 address, so it is accepted only as a canonical dotted quad: four decimal parts, 0 to 255, no leading zero, no trailing dot.host_within(host, domain): an IP address has no subdomains, and is within only itself. It replaces the three suffix checks: device sign-in links, the company'sdevice_page, and Browser Control's company hosts.The URLs 1.0.2 missed
These accepted an
https://URL withoutbrowser_safe, and now ask it too:PapSignIn.organization_logoUcpProfile.endpointanducp_agent_header(the platform profile)unverified), as a Signature-Agent that is no URL already didprotected_resourcesTests
test_urls.py: abbreviated, octal, hexadecimal, single-number, leading-zero, out-of-range and trailing-dot hosts refused. Canonical addresses and names are still accepted.host_withinwithout subdomains for addresses. The logo and the UCP endpoint each refuse the backslash and a numeric host. A check that every prefix-only site asksbrowser_safe.Version
1.0.3 in
__version__.py,package.json, the four runtime plugin manifests, the compatibility page, the conformance report and the CHANGELOG.